alter table jms_dm.dm_tab_scan_piece_summary_dt set tblproperties ('external.table.purge' = 'true');
drop table jms_dm.dm_tab_scan_piece_summary_dt;
CREATE EXTERNAL TABLE jms_dm.dm_tab_scan_piece_summary_dt
(

    format_scan_time  string comment '格式化日期',
    scan_user_code    string comment '扫描员code',
    organization_code string comment '中心组织code',
    supplier_id     string comment '供应商id',
    scan_type_code    string comment '扫描类型code 1：发件 2：到件 3：拆包',
    network_code      string comment '网点code',
    organization_name string comment '中心组织name',
    supplier_code     string comment '供应商编码',
    supplier_name     string comment '供应商名',
    scan_type         string comment '扫描类型',
    network_name      string comment '网点名',
    network_type      tinyint comment '网点类型:1-总部,2-代理区,3-加盟商,4-中心,5-集散点,6-网点',
    pre_site_code     string comment '上一站code',
    pre_site_name     string comment '上一站',
    next_site_code    string comment '下一站code',
    next_site_name    string comment '下一站',
    shipment_no       string comment '任务号',
    shipment_name     string comment '任务名称',
    scan_user         string comment '扫描员',
    scan_user_id      string comment '扫描员id',
    scan_user_type    string comment '扫描员员工属性1临时工/2正式工/3小时工(已废弃)/4职能/5环节外包',
    parts_cnt         bigint comment '散件件数',
    packages_cnt      bigint comment '包件数',
    in_packages_cnt   bigint comment '包内件数',
    scan_cnt          bigint comment '扫描件数',
    weight            decimal(10, 2) comment '重量',
    hours             string comment '小时',
    date_time         date comment 'sr分区',
    hours_range       string comment '小时区间'
) COMMENT '智能设备计件数据统计' PARTITIONED BY (
    `dt` string)
    STORED AS PARQUET
    LOCATION '/dw/hive/jms_dm.db/external/dm_tab_scan_piece_summary_dt'
    TBLPROPERTIES (
        'discover.partitions' = 'false',
        'parquet.column.index.access' = 'true'
        );